package com.pactera.rabbitmq.service.consumer;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;

import java.util.Map;

/**
 * 实时数据订阅类
 *
 * @author: liqingdian
 **/
public abstract class RtdsSubscriber implements Subscriber, ChannelAwareMessageListener {
    private static final Logger log = LoggerFactory.getLogger(RtdsSubscriber.class);

    @Override
    public void recevice(Message message) {
        log.info(JSON.toJSONString(message));
    }

    public abstract Long getRetryCount(MessageProperties properties);

    public abstract String getOrigRoutingKey(MessageProperties properties, String defaultValue);

    public abstract MessageProperties createOverrideProperties(MessageProperties properties, Map<String, Object> headers);
}
